home *** CD-ROM | disk | FTP | other *** search
-
- function units_destroyer_setup()
- units_setup_sea(5,false,true,ENET_EFFECT_GEOMETRY_TORPEDOSHIPSHADOW)
- end
-
- function units_destroyer_resetup()
- units_setup_sea(5,false,false,ENET_EFFECT_GEOMETRY_TORPEDOSHIPSHADOW)
- end
-
- function units_destroyer_select()
- units_select(17,2)
- end
-
- function units_destroyer_unselect()
- units_unselect()
- end
-
- function units_destroyer_selectenemy()
- uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
- end
-
- function units_destroyer_damaged()
- uniGetExecutor():applyDamage(uniGetLife())
- end
-
- function units_destroyer_highlight()
- uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
- end
-
- function units_destroyer_explode()
- units_explode_water4()
- end
-
- function units_destroyer_move()
- local unit = uniGetExecutor()
- local sound = unit:play3DSound("destroyer_move.wav",1)
- local steps = unit:addSimpleEffect(ENET_EFFECT_EFFECTEMITTER_SHIP_WATERTRAY)
- waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 0.7))
- waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_LINEAR,80))
- steps:suspendedDestroy(2.0)
- sound:destroy()
- end
-
- function units_destroyer_fire1()
- local unit = uniGetExecutor()
- local gt = unit:getBone(ENBT_GUNTOWER)
- local sound = gt:play3DSound("destroyer_guntower_rotate.wav",1)
- waitDeath(gt:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERTOTARGET,MATH_PI,uniGetTarget()))
- sound:stopSound()
- pause(0.3)
- local firespot = gt:getBone(ENBT_FIRE1)
- local shot = firespot:addBulletEffect(ENET_EFFECT_BULLET_REDLASERBOLT)
- shot:executeCommand(ENC_FIRE1)
- unit:addFireArrow()
- end
-
- function units_destroyer_fire2()
- local unit = uniGetExecutor()
- uniSetLife(uniGetLife() / 2.0)
- waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 0.7,uniGetTarget()))
- local gn = unit:getBone(ENBT_GUNNEST)
- unit:addAnimationToQueue(ENAT_PREPAREFORFIRE1,1)
- unit:addAnimationToQueue(ENAT_FIREPOSITION1,MATH_INFINITY)
- unit:addAnimationToQueue(ENAT_AFTERFIRE1,1)
- pause(0.3)
- gn:getBone(ENBT_FIRE2,0):addBulletEffect(ENET_EFFECT_BULLET_TORPEDO):executeCommand(ENC_FIRE1)
- pause(1.0)
- gn:getBone(ENBT_FIRE2,1):addBulletEffect(ENET_EFFECT_BULLET_TORPEDO):executeCommand(ENC_FIRE1)
- pause(1.0)
- unit:setCurrentAnimationRepeatCount(0)
- unit:addFireArrow()
- end
-
- registerCommand(ENSCRIPTSET_TORPEDOSHIP,ENC_MOVE,"units_destroyer_move")
- registerCommand(ENSCRIPTSET_TORPEDOSHIP,ENC_FIRE1,"units_destroyer_fire1")
- registerCommand(ENSCRIPTSET_TORPEDOSHIP,ENC_FIRE2,"units_destroyer_fire2")
- registerCommand(ENSCRIPTSET_TORPEDOSHIP,ENC_SELECT,"units_destroyer_select")
- registerCommand(ENSCRIPTSET_TORPEDOSHIP,ENC_SELECTENEMY,"units_destroyer_selectenemy")
- registerCommand(ENSCRIPTSET_TORPEDOSHIP,ENC_UNSELECT,"units_destroyer_unselect")
- registerCommand(ENSCRIPTSET_TORPEDOSHIP,ENC_SETUP,"units_destroyer_setup")
- registerCommand(ENSCRIPTSET_TORPEDOSHIP,ENC_RESETUP,"units_destroyer_resetup")
- registerCommand(ENSCRIPTSET_TORPEDOSHIP,ENC_DAMAGED,"units_destroyer_damaged")
- registerCommand(ENSCRIPTSET_TORPEDOSHIP,ENC_EXPLODE,"units_destroyer_explode")
- registerCommand(ENSCRIPTSET_TORPEDOSHIP,ENC_HIGHLIGHT,"units_destroyer_highlight")
-
- -- make description of unit
- desc = getEffectDescriptionP(ENET_UNIT_TORPEDOSHIP)
- desc.ClassID = ENCLASS_MESHINSTANCE
- desc.EffectClassType = ENECT_GEOMETRY
- desc.FileName = "torpedoship.rmd"
- desc.ScriptSet = ENSCRIPTSET_TORPEDOSHIP
- desc.MoveType = ENMOVE_SWIM
- desc.RenderType = ENRENDERTYPE_GEOMETRY
- desc.Material = ENMAT_RIGIDSKINNEDMESH
- desc.MaterialColors = units_materialcolors_human
-
- -- shadow
- desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_TORPEDOSHIPSHADOW)
- desc.ClassID = ENCLASS_MESHINSTANCE
- desc.EffectClassType = ENECT_GEOMETRY
- desc.FileName = "torpedoship_shadow.rmd"
- desc.RenderType = ENRENDERTYPE_SHADOW
- desc.Material = ENMAT_SHADOW
- desc.MaterialColors = units_materialcolors_shadow
-
- -- register new unit to logic
- unitDesc = logic_getUnitDescP(8)
- unitDesc.group = 1
- unitDesc.order = 0
- unitDesc.unit_res_id = ENET_UNIT_TORPEDOSHIP
- unitDesc.unit_icon_id = "Torpedoship_h_small_normal.dds"
- unitDesc.active_id = "Torpedoship_h_small_active.dds"
- unitDesc.pressed_id = "Torpedoship_h_small_pressed.dds"
- unitDesc.big_icon_id = "Torpedoship_h_big_normal.dds"
- unitDesc.small_icon_id = "Torpedoship_u_stats.dds"
- unitDesc.HP = 5
- unitDesc.MP = 30
- unitDesc.WR = 2
- unitDesc.min_WR = 1
- unitDesc.WD = 1
- unitDesc.WR2 = 0
- unitDesc.min_WR2 = 0
- unitDesc.WD2 = 0
- unitDesc.ability = 3
- unitDesc.transport = 0
- unitDesc.value = 2
- unitDesc.race = 0
- unitDesc.fire_pause = 0.8
- unitDesc.move_pause = 1.0
- unitDesc.unit_info_scale = 0.04
- unitDesc.scn_name = "DESTROYER"
-
- ------------------------------------------------------------------------------------------------------
- ------------------------ effects related to unit------------------------------------------------------
- ------------------------------------------------------------------------------------------------------
-
- function bullets_torpedo_fire()
- local bullet = uniGetExecutor()
- bullet:setTransformOwner()
- local sound = bullet:play3DSound("destroyer_torpedo_fly.wav",1)
- local track = bullet:addSimpleEffect(ENET_EFFECT_PS_TORPEDO_WATERTRAY)
- waitDeath(bullet:forwardFly(uniGetTarget(),100))
- sound:destroy()
- track:suspendedDestroy(1.0)
- bullet:play3DSound("destroyer_torpedo_explode.wav",0):destroy()
- bullet:setVisibility(false,true)
- bullet:addSimpleEffect(ENET_EFFECT_LIGHT_ROCKETEXPLODE):delayedDestroy(2.0)
- bullet:addSimpleEffect(ENET_EFFECT_PS_TORPEDOHIT):suspendedDestroy(2.0)
- uniGetTarget():executeCommand(ENC_DAMAGED)
- pause(2.0)
- bullet:destroy()
- end
-
- registerCommand(ENSCRIPTSET_BULLET_TORPEDO,ENC_FIRE1,"bullets_torpedo_fire")
-
-
-
- function bullets_redlaserbolt_fire()
- local bullet = uniGetExecutor()
- bullet:setTransformOwner()
- bullet:play3DSound("destroyer_laserfire.wav",0):destroy()
- local light = bullet:addSimpleEffect(ENET_EFFECT_LIGHT_REDLASERBOLTFLY)
- local track = bullet:addSimpleEffect(ENET_EFFECT_PS_REDLASERBOLT)
- waitDeath(bullet:addMoveEffect(ENET_EFFECT_MOVE_LINEARFLY,400,uniGetTarget()),1000)
- light:destroy()
- track:destroy()
- local hit_ps = bullet:addSimpleEffect(ENET_EFFECT_PS_REDLASERBOLTHIT)
- pause(0.2)
- hit_ps:suspendedDestroy(1.0)
- uniGetTarget():executeCommand(ENC_DAMAGED)
- pause(1.0)
- bullet:destroy()
- end
-
- registerCommand(ENSCRIPTSET_BULLET_REDLASERBOLT,ENC_FIRE1,"bullets_redlaserbolt_fire")
-